package RuiGe;

import java.util.Scanner;

public class Demo4 {

    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int[][] arr=new int[n][n];
        boolean Single=true;
        int tmp=1;
        for(int i=0;i<2*n-1;i++){
            if(Single){
                Single=false;
                int l=0;
                int k=0;
                if(i>=n){
                    l=n-1;
                    k=i-n+1;
                }
                else{
                    l=i;
                    k=0;
                }
                while(l>=0&&l<=n-1&&k>=0&&k<=n-1){
                    arr[l--][k++]=tmp++;
                }
            }
            else{
                Single=true;
                int l=0;
                int k=0;
                if(i>=n){
                    l=n-1;
                    k=i-n+1;
                }
                else{
                    l=i;
                    k=0;
                }
                while(l>=0&&l<=n-1&&k>=0&&k<=n-1){
                    arr[k++][l--]=tmp++;
                }
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                System.out.print(arr[i][j]+" ");
            }
            System.out.println();
        }
    }
}
